<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="com.example.simpleforum.model.Reply" %>
<!DOCTYPE html>
<html>
<head>
    <title>编辑回复 - 极简论坛</title>
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
    <h1>编辑回复</h1>
    <% if (request.getAttribute("error") != null) { %>
    <div class="error"><%= request.getAttribute("error") %></div>
    <% } %>
    <% 
        Reply reply = (Reply) request.getAttribute("reply");
        if (reply != null) {
    %>
    <form action="ReplyEditServlet" method="post">
        <input type="hidden" name="id" value="<%= reply.getId() %>">
        <div class="form-group">
            <label for="content">内容</label>
            <textarea id="content" name="content" required><%= reply.getContent() %></textarea>
        </div>
        <div class="actions">
            <button type="submit">保存</button>
            <a href="PostDetailServlet?id=<%= reply.getPostId() %>" class="btn">取消</a>
        </div>
    </form>
    <% } else { %>
    <p>回复不存在或已被删除</p>
    <a href="PostListServlet" class="btn">返回列表</a>
    <% } %>
</div>
</body>
</html>